﻿<style>
    .height800 {
        max-height: 800px;
        overflow-y: auto;
    }
    .wicon {
        background-image: url("");
        background-repeat: no-repeat;
        background-position: right center;
    }

    .workinput {
        width: 100%;
        line-height: 21px;
        border: 1px #ddd solid;
        border-radius: 4px;
        padding: 5px;
        background-color: transparent;
        float: left;
        font-size: 14px;
    }
</style>
<div>
    <div class="form-inline pull-right">
        <button class="btn btn-info waves-effect" ng-click="list.GetPageData(paginationConf.currentPage, paginationConf.itemsPerPage);">
            <span class="glyphicon glyphicon-refresh"></span>
        </button>
        <button class="btn btn-info waves-effect" ng-click="add()">
            <span class="glyphicon glyphicon-plus"></span>
        </button>
        <div class="input-group">
            <span class="input-group-addon">全局搜索：</span>
            <div class="fg-line">
                <input type="text" class="form-control" ng-change="search(kw)" ng-model="kw" placeholder="全局搜索" />
            </div>
        </div>
    </div>
    <table ng-table="list.tableParams" class="table table-bordered table-hover table-condensed listTable" ng-form="list.tableForm" tracked-table="list.tableTracker">
        <tr ng-repeat="row in $data" ng-form="rowForm" tracked-table-row="row">
            <td title="'id'">
                {{row.Id}}
            </td>
            <td title="'标题'">
                <a ng-click="detail(row)" target="_blank">{{row.Title}}</a>
            </td>
            <td title="'推广地址'">
                <a ng-href="{{row.Url}}" target="_blank">{{row.Url}}</a>
            </td>
            <td title="'当前竞价'">
                {{row.Price}}
            </td>
            <td title="'当月曝光量'">
                {{row.DisplayCount}}
            </td>
            <td title="'当月点击'">
                {{row.ViewCount}}
            </td>
            <td title="'日均点击'">
                {{row.AverageViewCount}}
            </td>
            <td title="'分类'" style="max-width: 220px">
                {{row.CategoryNames}}
            </td>
            <td title="'创建时间'">
                {{row.CreateTime|date:'yyyy-MM-dd HH:mm'}}
            </td>
            <td title="'修改时间'">
                {{row.UpdateTime|date:'yyyy-MM-dd HH:mm'}}
            </td>
            <td title="'状态'">
                <label class="el-switch">
                    <input type="checkbox" name="switch" ng-checked="row.Status==1">
                    <span class="el-switch-style" ng-click="changeState(row)"></span>
                </label>
            </td>
            <td title="'操作'" style="width: 160px;">
                <div class="btn-group">
                    <button class="btn btn-info btn-sm waves-effect" ng-click="edit(row)">
                        <i class="icon-pencil"></i>
                    </button>
                    <a class="btn btn-success btn-sm waves-effect" ng-click="copy(row)">
                        <i class="zmdi zmdi-copy zmdi-hc-fw"></i>
                    </a>
                    <button class="btn btn-danger btn-sm waves-effect" ng-click="remove(row)">
                        <i class="icon-bin"></i>
                    </button>
                </div>
            </td>
        </tr>
    </table>
    <tm-pagination conf="paginationConf"></tm-pagination>
</div>
<div id="edit" class="modal">
    <div class="container-fluid" style="margin: 15px 0;">
        <div class="card-body bgm-white">
            <div ng-show="!isAdd">
                <input type="hidden" ng-model="partner.Id">
            </div>
            <div class="form-group">
                <div class="input-group">
                    <label for="desc" class="input-group-addon control-label">广告标题：</label>
                    <div class="fg-line">
                        <input type="text" class="form-control" id="title" placeholder="请输入广告标题" ng-model="partner.Title">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <label for="desc" class="input-group-addon control-label">广告描述：</label>
                    <div class="fg-line">
                        <textarea type="text" class="form-control" id="desc" placeholder="请输入广告描述" ng-model="partner.Description" rows="5"></textarea>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <label for="desc" class="input-group-addon control-label">推广地址：</label>
                    <div class="fg-line">
                        <input type="text" class="form-control" id="url" placeholder="请输入推广目标地址" ng-model="partner.Url">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <label for="desc" class="input-group-addon control-label">宣传大图片：</label>
                    <div class="fg-line">
                        <input type="text" class="form-control" id="imgurl" placeholder="请输入图片URL" ng-model="partner.ImageUrl">
                    </div>
                    <span class="input-group-btn">
                        <button class="btn btn-success" ng-click="upload('ImageUrl')">上传本地图片</button>
                    </span>
                </div>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <label for="desc" class="input-group-addon control-label">宣传小图片：</label>
                    <div class="fg-line">
                        <input type="text" class="form-control" id="ThumbImgUrl" placeholder="请输入图片URL" ng-model="partner.ThumbImgUrl">
                    </div>
                    <span class="input-group-btn">
                        <button class="btn btn-success" ng-click="upload('ThumbImgUrl')">上传本地图片</button>
                    </span>
                </div>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <label for="desc" class="input-group-addon control-label">分类：</label>
                    <div class="ui fluid top search multiple selection dropdown category">
                        <input name="category" type="hidden" id="category">
                        <i class="dropdown icon"></i>
                        <div class="default text">请选择分类</div>
                        <div class="menu">
                            <div class="item" data-value>无</div>
                            <div class="item" ng-repeat="item in cat track by $index" data-value="{{item.Id}}">{{item.Name}}</div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="input-group">
                    <label for="desc" class="input-group-addon control-label">推广区域：</label>
                    <div class="ui fluid search multiple selection dropdown types">
                        <input name="types" type="hidden" id="types">
                        <i class="dropdown icon"></i>
                        <div class="default text">请选择推广区域</div>
                        <div class="menu">
                            <div class="item" data-value="1">轮播图</div>
                            <div class="item" data-value="2">列表项</div>
                            <div class="item" data-value="3">边栏</div>
                            <div class="item" data-value="4">内页</div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-inline">
                <div class="form-group">
                    <div class="input-group">
                        <label for="desc" class="input-group-addon control-label">当前竞价：</label>
                        <div class="fg-line">
                            <input type="number" class="form-control" id="price" placeholder="竞价" ng-model="partner.Price">
                        </div>
                    </div>
                </div>
                <div class="input-group">
                    <label for="desc" class="input-group-addon control-label">过期时间：</label>
                    <div class="fg-line">
                        <input type="text" class="workinput wicon" id="timespan" ng-model="partner.ExpireTime" readonly="readonly" />
                    </div>
                </div>
            </div>
                <div class="form-group form-inline">
                    <div class="input-group">
                        <label for="region" class="input-group-addon control-label">投放地区：</label>
                        <div class="fg-line">
                            <input type="text" class="form-control" id="region" placeholder="竖线或逗号分隔，支持国家、地区、城市、运营商、ASN" ng-model="partner.Regions" style="width: 460px">
                            <div class="ui selection dropdown region" style="min-width: 60px">
                                <input name="category" type="hidden">
                                <i class="dropdown icon"></i>
                                <div class="default text">不限</div>
                                <div class="menu">
                                    <div class="item" data-value="0">不限</div>
                                    <div class="item" data-value="1">以内</div>
                                    <div class="item" data-value="2">以外</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-xs-12">
                        <div class="fg-line">
                            <div class="btn-group">
                                <button type="button" class="btn btn-info" ng-click="submit(partner)">
                                    保存
                                </button>
                                <button type="button" class="btn btn-danger" ng-click="closeAll()">
                                    取消
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
</div>
<div id="detail" class="modal">
    <div class="container-fluid" style="margin: 15px 0;">
        <div class="card-body bgm-white height800">
            <table class="table table-bordered table-hover">
                <tr>
                    <td style="min-width: 110px">描述</td>
                    <td colspan="3">{{partner.Description}}</td>
                </tr>
                <tr>
                    <td>推广地址</td>
                    <td>
                        <a ng-href="{{partner.Url}}" target="_blank">{{partner.Url}}</a>
                    </td>
                    <td>过期时间</td>
                    <td>
                        {{partner.ExpireTime|date:'yyyy-MM-dd HH:mm:ss'}}
                    </td>
                </tr>
                <tr>
                    <td>类型：</td>
                    <td>
                        <div class="ui fluid search multiple selection dropdown types">
                            <input name="types" type="hidden">
                            <i class="dropdown icon"></i>
                            <div class="default text">类型</div>
                            <div class="menu">
                                <div class="item" data-value="1">轮播图</div>
                                <div class="item" data-value="2">列表项</div>
                                <div class="item" data-value="3">边栏</div>
                                <div class="item" data-value="4">内页</div>
                            </div>
                        </div>
                    </td>
                    <td>分类：</td>
                    <td>{{partner.CategoryNames}}</td>
                </tr>
                <tr>
                    <td>宣传大图片</td>
                    <td colspan="3">
                        <a ng-href="{{partner.ImageUrl}}" target="_blank">
                            <img class="img-rounded img-responsive" style="max-height: fit-content" src="{{partner.ImageUrl}}" />
                        </a>
                    </td>
                </tr>
                <tr>
                    <td>宣传小图片</td>
                    <td colspan="3">
                        <a ng-href="{{partner.ThumbImgUrl}}" target="_blank">
                            <img class="img-rounded img-responsive" style="max-height: fit-content" src="{{partner.ThumbImgUrl}}" />
                        </a>
                    </td>
                </tr>
                <tr>
                    <td>竞价：{{partner.Price}}</td>
                    <td>点击量：{{partner.ViewCount}}</td>
                    <td>日均点击量：</td>
                    <td>{{partner.AverageViewCount}}</td>
                </tr>
                <tr>
                    <td>上架时间：</td>
                    <td>{{partner.CreateTime|date:'yyyy-MM-dd HH:mm:ss'}}</td>
                    <td>更新时间：</td>
                    <td>{{partner.UpdateTime|date:'yyyy-MM-dd HH:mm:ss'}}</td>
                </tr>
                <tr>
                    <td>投放范围</td>
                    <td colspan="3">
                        <p ng-if="partner.RegionMode==0">不限</p>
                        <p ng-if="partner.RegionMode==1">{{partner.Regions}}<span class="text-danger">（以内）</span></p>
                        <p ng-if="partner.RegionMode==2">{{partner.Regions}}<span class="text-danger">（以外）</span></p>
                    </td>
                </tr>
            </table>
            <div class="btn-group">
                <button class="btn btn-info btn-sm waves-effect" ng-click="edit(partner)">
                    编辑
                </button>
                <button class="btn btn-danger btn-sm waves-effect" ng-click="remove(partner)">
                    删除
                </button>
            </div>
        </div>
    </div>
</div>
<div id="img-upload" class="modal">
    <form id="uploadform" onsubmit="return false" enctype="multipart/form-data">
        <div class="file-box">
            <div class="input-group">
                <div class="fg-line">
                    <input type="text" name="file0" disabled class="form-control" placeholder="请选择一张图片" />
                </div>
                <span class="input-group-btn hidden">
                    <a href="javascript:void(0);" class="btn btn-info ">浏览</a>
                </span>
                <input type="file" class="uploadFile" name="file" onchange="getFile(this, 'file0')" style="width: 200px"/>
                <span class="input-group-btn">
                    <button type="button" class="btn btn-primary" ng-click="uploadImage(imgField)">开始上传</button>
                </span>
            </div>
        </div>
    </form>
</div>